xlv.imp.dmc={
	implement:function(){
	},
	method:{
		dmc_properties:{
			dmArray:[],
			_startdmArray:[]
		},
		dmc_dmRegister:function(dm){
			var dms=this.dmc_properties.dmArray;
			if(dm.$P.globe==true && this!=this.getDesktop()){
				dms.push(dm);
				return this.getDesktop().dmc_dmRegister(dm);
			}
			if(dm.$P.globe==true){
				for(var i=0;i<dms.length;++i) {
					if(dms[i].getName()==dm.getName()){
						dms[i].$V.__refCount+=1;
						this.getDesktop().dmc_dmRegisterStart(dms[i]);
						return dms[i];
					}
				}
			}
			dm.$V.__refCount=1;
			dms.push(dm);
			this.getDesktop().dmc_dmRegisterStart(dm);
			return dm;
		},
		dmc_dmRegisterStart:function(dm){
			if(this==this.getDesktop()){
				var dms=this.dmc_properties._startdmArray;
				for(var i=0;i<dms.length;++i)if(dms[i]==dm) return;
				dms.push(dm);
			}
		},
		dmc_dmStart:function(){
			if(this==this.getDesktop()){
				var dms=this.dmc_properties._startdmArray;
				for(var i=0;i<dms.length;++i) dms[i].start();
				this.dmc_properties._startdmArray=[];
			}
		},
		dmc_dmUnregister:function(dm){
			var dms=this.dmc_properties.dmArray;
			var dm_name=dm.getName();
			if(dm.$P.globe==true && this!=this.getDesktop()){
				this._dmc_dmRemove(dm_name);
				this.getDesktop().dmc_dmUnregister(dm);
				return;
			}
			if(dm.$P.globe==true){
				for(var i=0;i<dms.length;++i){
					if(dm_name==dms[i].getName()) {
						dms[i].$V.__refCount-=1;
						if(dms[i].$V.__refCount<=0) dms.splice(i,1);
						return;
					}
				}
			}
			this._dmc_dmRemove(dm_name);
		},
		_dmc_dmRemove:function(dm_name){
			var dms=this.dmc_properties.dmArray;
			for(var i=0;i<dms.length;++i){
				if(dm_name==dms[i].getName()) {
					dms.splice(i,1);
					return;
				}
			}
		},
		dmc_dmLookup:function(dm_name){
			var dms=this.dmc_properties.dmArray;
			for(var i=0;i<dms.length;++i) {
				if(dms[i].getName()==dm_name && !dms[i].isDisposed()) 
					return (dms[i].$P.globe&&this!=xlv.desktop)? xlv.desktop.dmc_dmLookup(dm_name):dms[i];
			}
			return null;
		}
	}
};

